package com.zhangyu.shadow;

import android.app.Application;

import com.joanzapata.iconify.fonts.FontAwesomeModule;
import com.orhanobut.logger.AndroidLogAdapter;
import com.squareup.leakcanary.LeakCanary;
import com.zhangyu.shadow.core.app.Shadow;
import com.zhangyu.shadow.core.net.interceptors.AddCookieInterceptor;
import com.zhangyu.shadow.core.net.interceptors.DebugInterceptor;
import com.zhangyu.shadow.ec.database.DatabaseManager;
import com.zhangyu.shadow.ec.icon.FontEcModule;
import com.zhangyu.shadow.event.TestEvent;

/**
 * @author zhangyu
 * @date 2017/10/18
 */

public class ExampleApp extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        //检测是否存在内存泄漏
        LeakCanary.install(this);
        Shadow.init(this)
                .withApiHost("http://192.168.1.25:8080/RestServer/api/")
                .withIcon(new FontAwesomeModule())
                .withIcon(new FontEcModule())
                .withInterceptor(new DebugInterceptor("test", R.raw.test))
                .withLogger(new AndroidLogAdapter())
                .withWeChatAppId("wxd1b4b647023114d5")
                .withWeChatAppSecret("811bec076a78a0a96142c6cf13ebc653")
                .withJavascriptInterface("shadow")
                .withWebEvent("test", new TestEvent())
                .withWebHost("https://www.baidu.com/")
                .withInterceptor(new AddCookieInterceptor())
                .configure();
        DatabaseManager.getInstance().init(this);
    }
}
